package com.hhxyjsj.responsibility;

/**
 * 超过80000元的部分的税率为45%
 *  
 * @author Puhui
 *
 */
public class ThreeLevelTaxCalculation extends TaxCalculation {

	@Override
	public double calc(double amount) {
		TaxCalculation taxCalculation = super.getTaxCalculation();

		//判断判断如果扣除4险一金、起步线3500后的工资小于80000，则调用上一级别的计算类进行计算
		if(amount <= 80000){
			return taxCalculation != null ? taxCalculation.calc(amount) : 0;
		}
		
		double tax = (amount - 80000) * 0.45;
		if(taxCalculation == null){
			return tax;
		}
		
		return tax + taxCalculation.calc(amount - (amount - 80000));
	}

}
